import {defineAsyncComponent, App} from "vue";
import CommonComponents, {ComponentMps} from "@/components/index"

/**
 * 注册全局组件
 */
const AdminComponents: Array<ComponentMps> = [
    //全局数据组件
    {"name": "admin-auth", "component": defineAsyncComponent(() => import("./AdminAuth.vue"))},//权限组件
]

export default {
    install(app: App) {
        //注册全局组件
        for (let Componen of CommonComponents) {
            app.component(Componen.name, Componen.component);
        }

        //注册后台组件
        for (let Componen of AdminComponents) {
            app.component(Componen.name, Componen.component);
        }
    }
}